package com.superc.lib.helper;

import java.io.Serializable;

public class KeyValue<TK,TV> implements Comparable<KeyValue<TK,TV>>,Serializable{

	private static final long serialVersionUID = 1L;

	private TK key;
	
	private TV value;
	
	public KeyValue(TK key, TV value) {
		this.key = key;
		this.value = value;
	}

	/**
	 * @return the key
	 */
	public TK getKey() {
		return key;
	}


	/**
	 * @param key the key to set
	 */
	public void setKey(TK key) {
		this.key = key;
	}


	/**
	 * @return the value
	 */
	public TV getValue() {
		return value;
	}


	/**
	 * @param value the value to set
	 */
	public void setValue(TV value) {
		this.value = value;
	}

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public int compareTo(KeyValue<TK,TV> o) {
		KeyValue<TK,TV> compareObject=(KeyValue<TK,TV>)o;
		return ((Comparable)this.getKey()).compareTo(compareObject.getKey());
	}

	@Override
	public String toString() {
		return this.key.toString();
	}

}
